<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/layui/layui/css/layui.css}" rel="stylesheet"  media="all"/>
<link th:href="@{/css/font-awesome.min.css}" rel="stylesheet"  media="all"/>

<body class="gray-bg">
	<div class="container-div ui-layout-center">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="user-form">
					<input type="hidden" id="deptId" name="deptId">
	                <input type="hidden" id="parentId" name="parentId">
					<div class="select-list">
						<ul>
							<li>
								考核单元：
								<select name="analysisType"  style="width: 100px" th:with="type=${@dict.getType('sys_normal_disable')}">
									<option value="">所有</option>
									<option value="">前20天异常分析</option>
									<option value="">周内欠工时周末加班分析</option>
								</select>
							</li>
							<li>
								PDU：
								<select name="pdu" id = "pdu" style="width: 100px" th:with="type=${@dict.getType('sys_normal_disable')}">
									<option value="">所有</option>
								</select>
							</li>
							<li>
								地域：
								<select name="status" style="width: 100px" th:with="type=${@dict.getType('sys_normal_disable')}">
									<option value="">所有</option>
								</select>
							</li>
							<li class="select-time">
								<label>开始结束月份： </label>
								<input type="text" class="time-input" style="width: 100px" id="startEndMonth" placeholder="开始月份" name="params[beginTime]"/>
							</li>

							<li>
								<a class="btn btn-success btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-success btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>

			<div class="layui-tab layui-tab-card" style="margin-top:80px">
				<ul class="layui-tab-title">
					<li class="layui-this">周末加班超8小时</li>
					<li>月工时不足周末加班</li>
					<li>不在岗主动申报</li>
					<li>外出公干不合规</li>
					<li>月度工时不足8小时</li>
					<li>连续异常3天以上</li>
					<li>疑似月末补工时</li>
					<li>周末加班不足8小时</li>
					<li>周末加班工时异常处理</li>
				</ul>
				<div class="layui-tab-content">
					<div class="layui-tab-item layui-show">周末加班超8小时</div>
					<div class="layui-tab-item">月工时不足周末加班</div>
					<div class="layui-tab-item">不在岗主动申报</div>
					<div class="layui-tab-item">外出公干不合规</div>
					<div class="layui-tab-item">月度工时不足8小时</div>
					<div class="layui-tab-item">连续异常3天以上</div>
					<div class="layui-tab-item">
						<div class="col-sm-12 select-table table-bordered">
							<table id="bootstrap-table1"></table>
						</div>
					</div>
					<div class="layui-tab-item">
						<div class="col-sm-12 select-table table-bordered">
							<table id="bootstrap-table"></table>
						</div>

					</div>
					<div class="layui-tab-item">周末加班工时异常处理</div>
				</div>
			</div>
		</div>
	</div>

	<div th:include="include :: footer"></div>
	<script th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
	<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
	<script th:src="@{/ajax/libs/layui/layui/layui.js}"></script>
	<script th:inline="javascript">
		var editFlag = [[${@permission.hasPermi('system:user:edit')}]];
		var removeFlag = [[${@permission.hasPermi('system:user:remove')}]];
		var resetPwdFlag = [[${@permission.hasPermi('system:user:resetPwd')}]];
		var datas = [[${@dict.getType('sys_normal_disable')}]];
		var projects = [[${@dict.getType('sys_user_project_role')}]];
		var prefix = ctx + "worktime/board";

 		var options = {
		        url: prefix + "/list",
		        createUrl: prefix + "/add",
		        updateUrl: prefix + "/edit/{id}",
		        removeUrl: prefix + "/remove",
		        sortName: "createTime",
		        sortOrder: "desc",
		        modalName: "用户",
		        search: false,
		        showExport: false,
		        showColumns: false,
		        showRefresh: false,
		        showToggle: false,
		        showHeader: false,
		        showFooter: false,
		        searchable: false,
		        smartDisplay:false,
		        showSearch:false,
		        columns: [
		        {
		            field: 'hwCode',
		            title: '华为工号'
		        },
		        {
		            field: 'name',
		            title: '姓名'
		        },
		        {
		            field: 'checkDate',
		            title: '加班日期'
		        },
		        {
		            field: 'extraHours',
		            title: '加班小时'
		        },
		        {
		            title: '操作',
		            align: 'center',
		            width:"300",
		            formatter: function(value, row, index) {
		                var actions = [];
		                actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.userId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
		                actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.userId + '\')"><i class="fa fa-remove"></i>删除</a> ');
		                actions.push('<a class="btn btn-info btn-xs ' + resetPwdFlag + '" href="#" onclick="resetPwd(\'' + row.userId + '\')"><i class="fa fa-key"></i>重置</a>');
		                return actions.join('');
		            }
		        }]
		    };
		 $('#bootstrap-table1').bootstrapTable('refresh',options);
		//年月范围
		layui.use('laydate', function(){
		var laydate = layui.laydate;
		  laydate.render({
			elem: '#startEndMonth'
			,type: 'month'
			,range: true
			,max: maxDate()
			,done: function(value, date) {
				var months = value.split(" - ");
			}
		  });
		 });
		// 设置最大可选的日期
		function maxDate() {
			var now = new Date();
			return now.getFullYear() + "-" + (now.getMonth() + 1);
		}
		$(function() {
			$('body').layout({ west__size: 185 });
			queryWorktimeList();
			//queryInitOption();
		});


		function queryWorktimeList() {

		//$.table.init(options);

		}

		/*用户管理-部门*/
		function dept() {
			var url = ctx + "system/dept";
			createMenuItem(url, "部门管理");
		}

		/*用户管理-重置密码*/
		function resetPwd(userId) {
		    var url = prefix + '/resetPwd/' + userId;
		    $.modal.open("重置密码", url, '800', '300');
		}
		function queryInitOption(){
			$.ajax({
				cache : true,
				type : "POST",
				url : ctx+"worktime/board/init",
				data : {
					"roleId": 1
				},
				async : false,
				error : function(request) {
					$.modal.alertError("系统错误");
				},
				success : function(datas) {
					alert(datas.pdu);
					var actions = [];
                	$.each(datas.pdu, function(index, dict) {
                		actions.push("<option value="+dict+">"+dict+"</option>");
                    });
               		actions.join('');
               		$("#pdu").append(actions);
				}
			});
		}

		function edit() {
			var roleId = $("input[name='roleId']").val();
			var roleName = $("input[name='roleName']").val();
			var roleKey = $("input[name='roleKey']").val();
			var roleSort = $("input[name='roleSort']").val();
			var status = $("input[name='status']").is(':checked') == true ? 0 : 1;
			var remark = $("input[name='remark']").val();
			var menuIds = $.tree.getCheckedNodes();
			$.ajax({
				cache : true,
				type : "POST",
				url : ctx + "system/role/edit",
				data : {
					"roleId": roleId,
					"roleName": roleName,
					"roleKey": roleKey,
					"roleSort": roleSort,
					"status": status,
					"remark": remark,
					"menuIds": menuIds
				},
				async : false,
				error : function(request) {
					$.modal.alertError("系统错误");
				},
				success : function(data) {
					$.operate.saveSuccess(data);
				}
			});
		}


	</script>
</body>
</html>